'use strict'

 const { DataTypes, Model, Op } = require('../../azeroth').sequelize;
 class Doff extends Model { }

  const initDoffData = (sequelize_aim) => {
    Doff.init(
         {
             uid: {
                 field: 'uid',
                 type: DataTypes.BIGINT(11) ,
                 allowNull: false,
                 primaryKey: true,
                 autoIncrement: true,
             },
             jobId: {
                 field: 'jobId',
                 type: DataTypes.INTEGER,
             },
             create_time: {
                 field: 'create_time',
                 type: DataTypes.BIGINT,
             },
             startPosition: {
                 field: 'startPosition',
                 type: DataTypes.DECIMAL,
             },
             viewWidth: {
                 field: 'viewWidth',
                 type: DataTypes.INTEGER,
             },
             status: {
                 field: 'status',
                 type: DataTypes.INTEGER,
             },
             flawCount: {
                 field: 'flawCount',
                 type: DataTypes.INTEGER,
             },
             startTime: {
                 field: 'startTime',
                 type: DataTypes.INTEGER,
             },
             finishTime: {
                 field: 'finishTime',
                 type: DataTypes.INTEGER,
             },
             detectParam: {
                 field: 'detectParam',
                 type: DataTypes.TEXT,
             },
         },
         {
             freezeTableName: true,
             sequelize: sequelize_aim,
             modelName: 'panel_info',
             timestamps: false
         }
     )
  }

  Doff.uploadDoff = async (data) => {
     let res = await Doff.create({...data});
     return res;
 }

 module.exports = {
     Doff,
     initDoffData
 };